package com.snatch.work.service;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import com.snatch.common.constant.SnatchConstant;
import com.snatch.common.utils.StringUtils;
import com.snatch.work.service.impl.hg.HgSnatchDataImpl;

public class SnatchControl {
	/**
	 * 
	 * @param webCode Hg HgSnatchDataImpl
	 * @return
	 */
	
	static public ConcurrentMap<String, SnatchService> snatchServices = new ConcurrentHashMap<String, SnatchService>();// 每个登录线程的名字和线程ID

	public static SnatchService getSnatchService(String webCode){
		if(StringUtils.isNull(webCode)) return null;
		if(snatchServices.containsKey(webCode)){
			return snatchServices.get(webCode);
		}
		
		if(SnatchConstant.THIRD_SYSTEM_HG_VALUE.equals(webCode)){
			SnatchService snatchService = new HgSnatchDataImpl();
			snatchServices.put(webCode, snatchService);
			return snatchService;
		}
		return null;
	}
}
